#include "QtWall.h"
#include <QPainter>
#include "QtBlendToEffect.h"
#include "QtSequentialAnimationEffect.h"
#include "QtScaleToEffect.h"
#include "QtRotateToEffect.h"

QtWall::QtWall(const Direction& direction, QtSprite *parent): QtCellSprite(parent), duration(1000), wallDirection(direction)
{
	SetDirection(direction);

	SetResource("foreground", "wall");
}

QtWall::~QtWall()
{
}


void QtWall::SetDirection(const Direction& direction)
{
	wallDirection = direction;

	switch(wallDirection.Type())
	{
		case Direction::NORTH:
			SetAngle(0);
		break;

		case Direction::SOUTH:
			SetAngle(180);
		break;
	
		case Direction::WEST:
			SetAngle(270);
		break;
	
		case Direction::EAST:
			SetAngle(90);
		break;
	}
}

void QtWall::BackgroundUpdated()
{
	SetCenterPoint(QPointF(Background()->Width()/2, Background()->Height()/2));
}






